<?php

class Zend_View_Helper_Language{
	
	public function language($str){
		
		$cookie=Zend_Registry::get('langCookie');
		
		if($cookie=='BIG5'){
			
			$newStr="";
			
			$langArray=Zend_Registry::get('language');
			
			for($i=0;$i<mb_strlen($str);$i++){
				
				$key=mb_substr ( $str, $i, 1, 'UTF-8' );
				
				if(array_key_exists($key,$langArray)){
					
					$newStr.=$langArray[$key];
					
				}else{
					
					$newStr.=$key;
					
				}
				
			}
			
			return $newStr;
			
		}else if($cookie=='GB'){
			
			return $str;
			
		}else{
			
			return $str;
			
		}
		

		
	}

}

